package com.example.myapplicationndk.js;

import static com.example.myapplicationndk.utils.SPUtil.WEB_HISTORY_SEARCH_RECORD;

import android.util.Log;

import com.example.myapplicationndk.FlyApplication;
import com.example.myapplicationndk.utils.SPUtil;
import com.github.lzyzsd.jsbridge.BridgeHandler;
import com.github.lzyzsd.jsbridge.BridgeWebView;
import com.github.lzyzsd.jsbridge.CallBackFunction;
import com.google.gson.Gson;

public class AndroidJs {


    private static MainJsActivity context;
    static final String TAG = AndroidJs.class.getName();
    private static BridgeWebView webView;


    public static void riginsters(MainJsActivity activity, BridgeWebView mWebView) {
        context = activity;
        webView = mWebView;

        if (webView != null) {

            webView.registerHandler("submitFromWeb", new BridgeHandler() {
                @Override
                public void handler(String data, CallBackFunction function) {
                    Log.d(TAG, "submitFromWeb, data" + data);
                    function.onCallBack("java submitFromWeb back to you");
                }
            });
            webView.registerHandler("submitFromWeb2", new BridgeHandler() {
                @Override
                public void handler(String data, CallBackFunction function) {
                    Log.d(TAG, "submitFromWeb2, data" + data);
                    function.onCallBack("java submitFromWeb2 back to you");
                }
            });




        }


    }






}
